package com.controller;

import org.apache.http.message.BasicHeader;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

/**
 * Created by cuich on 2018/2/14.
 */
@RestController
public class Controller {
    @Autowired
    private RestHighLevelClient client;

    @RequestMapping(value = "/searchStatus")
    public boolean getSearchStatus(){
        try {
            boolean ping = this.client.ping(new BasicHeader("1", "2"));
            return ping;
        } catch (IOException e) {
            e.printStackTrace();
        }
        return false;
    }

}
